/*
 * 上海远境文化传媒有限公司 版权所有
 */
package helper;

import play.Logger;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 图片辅助工具类.
 */
public class ImageHelper {


    private static final Pattern PATTERN_IMAGE_NAME = Pattern.compile("\\.(jpg|jpeg|png|gif)$");

    public static boolean isImageFile(String fileName) {
        Matcher imageNameMatcher = PATTERN_IMAGE_NAME.matcher(fileName);
        if (!imageNameMatcher.find()) {
            Logger.error("LOG381653: 不是图片文件: %s", fileName);
            return false;
        }
        return true;
    }

}
